/**
 * 
 */
package TestCases;

import Tracer.RTVector;
import XMLScene.RTCamera;
import junit.framework.TestCase;

/**
 * @author Hongyi Zhao This is the test case for RTCamera
 */
public class RTCameraTest extends TestCase {
	/**
	 * The RTCamera instance for test
	 */
	private RTCamera camera = null;

	/**
	 * Constructor of RTCameraTest
	 * 
	 * @param name
	 */
	public RTCameraTest(String name) {
		super(name);
	}

	/**
	 * The setUp for Test Case, to initialize data
	 */
	protected void setUp() throws Exception {
		super.setUp();
		RTVector location = new RTVector(3.0f, 4.0f, -5.0f);
		RTVector look_at = new RTVector(0.0f, 5.0f, -10.0f);
		RTVector sky = new RTVector(0.0f, 0.0f, 1.0f);
		camera = new RTCamera(location, sky, look_at);
	}

	/**
	 * The tearDown for Test Case, to release the data
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
	}

	/**
	 * Test for GetLocationVector Function Will be equal to the expected result
	 * if pass
	 */
	public final void testGetLocationVector() {
		RTVector location = camera.getLocationVector();
		assertTrue("Location value wrong", location.isEqual(new RTVector(3.0f,
				4.0f, -5.0)));
	}

	/**
	 * Test for GetSkyVector Function Will be equal to the expected result if
	 * pass
	 */
	public final void testGetSkyVector() {
		RTVector sky = camera.getSkyVector();
		assertTrue("Sky value wrong", sky
				.isEqual(new RTVector(0.0f, 0.0f, 1.0f)));

	}

	/**
	 * Test for GetLookAtVector Function Will be equal to the expected result if
	 * pass
	 */
	public final void testGetLookatVector() {
		RTVector lookat = camera.getLookatVector();
		assertTrue("Lookat value wrong", lookat.isEqual(new RTVector(0.0f,
				5.0f, -10.0)));
	}

}
